package cn.diancan.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Version;

 
/**
 * 货品规格中间表
 * @author  
 *
 */

@Entity
public class ProductSpecificationValues   {
	
	private Long id;
	private Long productId;          //货品Id
	/*private Long pecificationValueId;//规格值Id*/	
	//@BelongsTo(foreignKey="pecificationValueId")
	//private SpecificationValue specificationValue;
	
	/*private Product product ;*/
	private SpecificationValue specificationValue;
	    private Integer version;
	    
	    @Version
	    @Column(name="OPTLOCK",columnDefinition="int(11) DEFAULT 0")
	    public Integer getVersion() {
	        return version;
	    }
	    public void setVersion(Integer version) {
	        this.version = version;
	    }

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	/*@ManyToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY)
	@JoinColumn(name="productId")
	public Product getProduct() {
		return product;
	}
	
	public void setProduct(Product product) {
		this.product = product;
	}
*/
	@ManyToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY)
	@JoinColumn(name="specificationValueId")
	public SpecificationValue getSpecificationValue() {
		return specificationValue;
	}
	
	public void setSpecificationValue(SpecificationValue specificationValue) {
		this.specificationValue = specificationValue;
	}

	
	
	
 	public Long getProductId() {
		return productId;
	}

	public void setProductId(Long productId) {
		this.productId = productId;
	}
/*
	public Long getPecificationValueId() {
		return pecificationValueId;
	}

	public void setPecificationValueId(Long pecificationValueId) {
		this.pecificationValueId = pecificationValueId;
	}*/

	 
	
	
 
}
